#include "button.h"

Button::Button()
{
}

Button::Button(QIcon icon, QString string, QWidget *parent) : QPushButton(icon, string, parent) {
    setParent(parent);
}

Button::Button(QIcon icon, QString string, QWidget *parent, QObject *item) : QPushButton(icon, string, parent)
{
    this->item=item;
}

void Button::enterEvent(QEvent * e)
{
    emit mouseEntered(this);
}

void Button::setItem(QObject *item) {
    this->item=item;
}

void Button::mousePressEvent(QMouseEvent *e) {
    QPushButton::mousePressEvent(e);
    if(Qt::RightButton==e->button()) {
        emit rightClicked();
    }
}

void Button::setIconSize(const QSize &size) {
    QPushButton::setIconSize(size);
    setMinimumWidth(size.width());
    setMaximumWidth(size.width()+10);
    setMinimumHeight(size.height());
    setMaximumHeight(size.height()+10);
}
